package main

import (
	"fmt"
	"time"
)

type ch[T any] chan T

func main() {

	c := make(ch[int])

	go func() {
		for i := 0; i < 5; i++ {
			c <- 1
		}
		close(c)
	}()

	time.Sleep(2 * time.Second)

	for {

		if v, ok := <-c; ok {
			fmt.Println(v)
		} else {
			return
		}
	}

}
